import { createStore } from 'vuex'
// 引入数据持久化
import persistedstate from 'vuex-persistedstate'
const store = createStore({
    state() {
        return {
            username: "", //用户信息
            role: '', //角色
            checkedkeys: [], //左侧菜单栏数据
        }
    },
    mutations: {
        //更新用户信息
        updataUsername(state, payload) {
            state.username = payload
        },
        //更新角色
        updataRole(state, payload) {
            state.role = payload
        },
        //更新菜单
        updatacheckedkeys(state, payload) {
            state.checkedkeys = payload
        }
    },
    actions: {

    },
    getters: {

    },
    plugins: [persistedstate()]


})


export default store